<?php
    /*
    Template Name: Course Listing

    */
?>

<?php get_header() ?>

	<div id="container">
		<div id="content">

			<?php the_post() ?>

				<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
					<h2 class="entry-title"><?php the_title() ?></h2>
                    <?php include ('socialbuttons.php'); ?>
					<div class="entry-content">
						<?php the_content() ?>
                        
                        <?php query_posts('category_name=Upcoming Solar Training Workshops&showposts=500&order=asc'); ?>
							<?php while (have_posts()) : the_post(); ?>
								
                                <!-- BEGIN COURSE LISTINGS -->
            
<div class="courselistingblock">
	<h2><a href="<?php the_permalink(); ?>"><?php echo get_post_meta($post->ID, 'MonthYear', true) ?> | <?php echo get_post_meta($post->ID, 'TrainingType', true) ?> Training</a></h2>
    <h3><?php echo get_post_meta($post->ID, 'CityState', true) ?> | <?php echo get_post_meta($post->ID, 'CourseDates', true) ?></h3>
    <div class="coursedetailsblock">
    	<div class="coursedetailsblockleft">
        	<h4>Workshop Details:</h4>
            <ul>
            	<li><strong>Training Type:</strong><span><?php echo get_post_meta($post->ID, 'TrainingType', true) ?></span></li>
                <li><strong>Location:</strong><span><?php echo get_post_meta($post->ID, 'CityState', true) ?></span></li>
                <li><strong>Dates:</strong><span><?php echo get_post_meta($post->ID, 'CourseDates', true) ?></span></li>
                <li><strong>Levels Available:</strong><span><?php echo get_post_meta($post->ID, 'Levels', true) ?></span></li>
                <li><strong>Instructor:</strong><span><?php echo get_post_meta($post->ID, 'Instructor', true) ?></span></li>
            </ul>
        </div> <!-- .coursedetailsblockleft -->
        <div class="coursedetailsblockright">
        	<div class="coursedetailsblockright-button1">
            	<a href="<?php the_permalink(); ?>">
                	<h4>View Workshop Details</h4>
                </a>
            </div>
            
            <?php // COnditional To Create Button 2 ?>
            <?php $button2=get_post_meta($post->ID, 'Button2Header', true); ?>
    		<?php if ( $button2 ) : ?>
            <div class="coursedetailsblockright-button2">
            	<h5><?php echo get_post_meta($post->ID, 'Button2Header', true) ?>: <?php echo get_post_meta($post->ID, 'Button2Price', true) ?></h5>
            	<p>Levels: <?php echo get_post_meta($post->ID, 'Button2Levels', true) ?> | <?php echo get_post_meta($post->ID, 'Button2Dates', true) ?></p>
            </div>
            <?php else : ?>
    		<?php endif; ?>
            
			<?php // COnditional To Create Button 3 ?>
            <?php $button3=get_post_meta($post->ID, 'Button3Header', true); ?>
    		<?php if ( $button3 ) : ?> 
            <div class="coursedetailsblockright-button3">
            	<h5><?php echo get_post_meta($post->ID, 'Button3Header', true) ?>: <?php echo get_post_meta($post->ID, 'Button3Price', true) ?></h5>
            	<p>Levels: <?php echo get_post_meta($post->ID, 'Button3Levels', true) ?> | <?php echo get_post_meta($post->ID, 'Button3Dates', true) ?></p>
            </div>
            <?php else : ?>
    		<?php endif; ?>
            
        </div> <!-- .coursedetailsblockright -->
        <div style="width: 578px; height: 0px; clear: both;"></div>
    </div> <!-- .coursedetailsblock -->
</div> <!-- .courselistingblock -->
            
            <!-- END COURSE LISTINGS -->
                                
							<?php endwhile;?>
                        
                    </div>
				</div><!-- .post -->

				<!-- INCLUDE END OF PAGE CTA BLOCK IF THE PAGE HAS A CTA URL -->
                <?php if(get_post_meta($post->ID, "ctaURL", true)){ include('inpagecta.php') ; } ?>

		</div><!-- #content -->
        
        <?php get_sidebar() ?>
        <div style="width: 920px; height: 0px; clear: both;"></div>
        
	</div><!-- #container -->

<?php get_footer() ?>